package com.fg.pro.model.sys.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.fg.pro.model.config.ValidationGroups;
import jakarta.validation.constraints.Max;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.Size;
import lombok.Data;

import java.io.Serializable;
import java.util.List;

/**
 * 菜单权限(SysMenu)表实体类
 *
 * @author makejava
 * @since 2025-07-17 10:10:47
 */
@SuppressWarnings("serial")
@Data
public class SysMenu extends Model<SysMenu> {
    //主键id
    private Long id;
    //菜单名称
    @NotEmpty(message = "菜单名称不能为空", groups = {ValidationGroups.Insert.class, ValidationGroups.Update.class})
    @Size(message = "菜单名称字符长度大于2，小于20", max = 20, min = 2, groups = {ValidationGroups.Insert.class, ValidationGroups.Update.class})
    private String menuName;
    //菜单描述
    private String menuDes;
    //菜单等级（1-1，2-2，3-3）
    @Max(message = "菜单等级最低为3", value = 3, groups = {ValidationGroups.Insert.class, ValidationGroups.Update.class})
    private Integer menuLev;
    //菜单排序
    private Integer menuSort;
    //菜单类型（get,put,post,delete）
    @NotEmpty(message = "菜单类型不能为空", groups = {ValidationGroups.Insert.class, ValidationGroups.Update.class})
    private String menuType;
    //菜单展示（0-不展示，1-展示）
    @NotEmpty(message = "菜单展示不能为空", groups = {ValidationGroups.Insert.class, ValidationGroups.Update.class})
    private Integer menuShow;
    //菜单父id（自连接）
    private Long menuParentId;
    //菜單圖片
    private String menuIcon;
    //路由映射路径
    private String menuRouterPath;
    //方法映射路径
    private String menuMappingPath;

    @TableField(exist = false)
    private List<SysMenu> children;


    /**
     * 获取主键值
     *
     * @return 主键值
     */
    @Override
    public Serializable pkVal() {
        return this.id;
    }
}

